local skel = fk.CreateSkill{
  name = "kqf__nanquan",
}

Fk:loadTranslationTable{
  ["kqf__nanquan"] = "难全",
  [":kqf__nanquan"] = "你的体力值变化后，你可以摸一至三张牌并展示手牌，若包含所有类别，你不能再以此法摸此量张牌。",

  ["@kqf__nanquan"] = "难全：",
  ["#kqf__nanquan_ask"] = "难全：你可以摸一至三张牌并展示手牌，若包含所有类别，你不能再以此法摸此量张牌",

  ["$kqf__nanquan1"] = "世事有失有得，吾已心有所择。",
  ["$kqf__nanquan2"] = "为保发儿无恙，妾身别无他法。",
}

skel:addEffect(fk.HpChanged, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and #player:getTableMark("@kqf__nanquan") < 3
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local marks = player:getTableMark("@kqf__nanquan")
    local chooselist = {"1","2","3"}
    if #marks > 0 then
      if table.contains(marks,"1") then table.removeOne(chooselist,"1") end
      if table.contains(marks,"2") then table.removeOne(chooselist,"2") end
      if table.contains(marks,"3") then table.removeOne(chooselist,"3") end
    end
    local choice = room:askToChoice(player,{
      prompt = "#kqf__nanquan_ask",
      choices = chooselist,
      skill_name = skel.name,
      cancelable = false,
    })
    local number
    if choice == "1" then
      number = 1
    elseif choice == "2" then
      number = 2
    elseif choice == "3" then
      number = 3
    end
    room:drawCards(player,number,skel.name)
    player:showCards(player:getCardIds("h"))
    local hcards = player:getCardIds("h")
    if table.find(hcards,function (c) return Fk:getCardById(c).type == Card.TypeBasic end) then
      if table.find(hcards,function (c) return Fk:getCardById(c).type == Card.TypeTrick end) then
        if table.find(hcards,function (c) return Fk:getCardById(c).type == Card.TypeEquip end) then
          room:addTableMarkIfNeed(player, "@kqf__nanquan", choice)
        end
      end
    end
  end,
})

return skel